package cn.koala.key.fileupload.service.impl;

import cn.koala.key.api.KeyManagementApi;
import cn.koala.key.configure.apollo.ApolloKeyManagementAdminConfig;
import cn.koala.key.fileupload.service.RepairImageUploadService;
import cn.seed.common.core.Result;
import feign.Feign;
import feign.form.spring.SpringFormEncoder;
import feign.jackson.JacksonDecoder;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

/**
 * @Description:附件上传业务实现
 * @author:方典典
 * @time:2017年10月17日 上午10:39:29
 */
@Service
public class RepairImageUploadServiceImpl implements RepairImageUploadService {

    @Override
    public Result<String> newImgfile(MultipartFile file,Integer categoryId,
                                     String referNo,String author) {
        return Feign.builder().decoder(new JacksonDecoder()).encoder(new SpringFormEncoder()).target(KeyManagementApi.class, ApolloKeyManagementAdminConfig.getFileUploadUrl()).
                fileUpload(file,categoryId,referNo,author);
    }

}

